"""
@File    :   validate.py
@Time    :   2024/04/24 23:14:22
@Author  :   Qrj
@Email   :   923207736@qq.com
@description   :   OAuth2客户端模式相关的pydantic验证模型
"""

from pydantic import BaseModel, Field, constr

from src.schemas.validate import NoUseEnumValuesBaseValidateSchemaConfigMixin


class ClientCredentialsCreateDoubleTokenValidateSchema(
    BaseModel, NoUseEnumValuesBaseValidateSchemaConfigMixin
):
    """用于创建Oauth2授权码模式的双Token的验证模型"""

    tenant_id: int = Field(default=..., description="租户ID")
    oauth2_client_client_id: str = Field(
        default=..., min_length=1, max_length=255, description="OAuth2客户端编号"
    )
    oauth2_client_client_secert: str = Field(
        default=..., min_length=1, max_length=255, description="OAuth2客户端密钥"
    )
    required_scopes: list[constr(min_length=1, max_length=100)] = Field(
        default_factory=list, description="用户选择的授权范围"
    )
